package com.bcbim.authentication_interface.util;

import com.bcbim.authentication_interface.application.bo.ApplicationBO;
import com.bcbim.common.util.AESUtil;
import org.apache.commons.lang3.ObjectUtils;

/**
 * @Description: 设置、获取登录用户工具类
 * @Author haoshuai
 * @Date 2020/11/23
 * @Version V1.0
 **/
public class ApplicationAuthUtil {

    private static final ThreadLocal<ApplicationBO> TL_USER = new ThreadLocal<>();

    /**
     * @Description: 将 LoginUser 放入 ThreadLocal
     * @Param: LoginUser user
     * @Author: haoshuai
     * @Date: 2020/11/23
     */
    public static void setApplication(ApplicationBO application) {
        TL_USER.set(application);
    }

    /**
     * @Description: 从 ThreadLocal 获取 LoginUser, id 已经过解密
     * @Return: LoginUser
     * @Author: haoshuai
     * @Date: 2020/11/23
     */
    public static ApplicationBO getApplication() {
        return TL_USER.get();
    }

}
